
#ifndef CRC_H_
#define CRC_H_

#include "string.h"

unsigned char crc8(unsigned char crc, unsigned char data);

template <int buffer_size>
unsigned char crc8(const String<buffer_size> &buffer)
{
  unsigned char crc = 0;
  int size = buffer.size();
  for (int idx = 0; idx < size; idx++) {
    crc = crc8(crc, buffer[idx]);
  }
  return crc;
}

#endif

